package com.example.demo.controller;

import com.example.demo.services.UsersService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UsersController {
    private final UsersService usersService;

    public UsersController(UsersService usersService) {
        this.usersService = usersService;
    }

    @PostMapping("/login")
    public int userLogin(@RequestParam String userID, @RequestParam String password) {
        //System.out.println(userID + "," + password);
        return usersService.Login(userID, password);
    }

    @PostMapping("/username")
    public String userName(@RequestParam String userID) {
        return usersService.name(userID);
    }

}
